﻿using System.Linq;
using FluentAssertions;
using NUnit.Framework;
using ReactiveGraph.Core;
using ReactiveGraph.Tests.Containers;

namespace ReactiveGraph.Tests
{
    [TestFixture]
    public class NodeEventTests
    {
        [Test]
        public void CreatePropertyChangedEvent()
        {
            var nodeFactory = new DefaultTestContainer();
            var node = nodeFactory.GetNode<IReactiveNode>();
            node.AttachProperty(new Property<string>("p1"));
            var e = NodeEvent.PropertyChanged(node, node.Properties.First(),"foo");

            e.Type.Should().Be(EventType.PropertyChange);
            e.Source.Node.Should().Be(node);
            e.Source.Property.Should().Be(node.GetProperty("p1"));
        }
    }
}
